package com.demo.feign.controller;


import com.demo.feign.client.UserServiceClient;
import com.demo.feign.dto.UserDTO;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "user")
@Api(value = "user", description = "用户管理", tags = {"user"})
public class UserController {

    @Autowired
    private UserServiceClient userServiceClient;



    @ApiOperation(value = "根据id查找用户", tags = {"user"}, nickname = "getUserById")
    @ApiImplicitParam(value = "编号",name = "id",paramType = "path")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "200:成功，否则失败")})
    @GetMapping(value = "/{id}")
    public UserDTO getUserById(@PathVariable("id") Long id) {
      return userServiceClient.getUserById(id);
    }
}
